﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Chain.DBUtility;

public partial class Mobile_New_GoodsDetail : System.Web.UI.Page
{
    private Chain.BLL.Goods GoodsBll = new Chain.BLL.Goods();
    private Chain.BLL.GoodsSlideshow GsBll = new Chain.BLL.GoodsSlideshow();

    public string SubStr(string input) {
        return  input.Substring(2);

    }

    protected void Page_Load(object sender, EventArgs e)
    {
        int GoodsID = Convert.ToInt32(base.Request["GoodsID"]);
        decimal GoodsPrice = Convert.ToDecimal(base.Request["GoodsPrice"]);
        this.hid_id.Value = GoodsID.ToString();
        this.hid_price.Value = GoodsPrice.ToString();


        DataTable dt = GoodsBll.GetList(" GoodsID=" + GoodsID).Tables[0];
        this.rptGoodsDetail.DataSource = dt;
        this.rptGoodsDetail.DataBind();


        DataRow[] drs = new Chain.BLL.MemCustomField().CustomGetList(" CustomType=2 ");
        if (drs.Length > 0)
        {
            foreach (DataRow dr in drs)
            {
                string columnname = dr["CustomField"].ToString();
                string standard = DbHelperSQL.Query(string.Format("select {0} from Goods where GoodsID={1}",columnname,GoodsID)).Tables[0].Rows[0][columnname].ToString();
                if (!string.IsNullOrEmpty(standard) && standard != "")
                {
                    this.standards.InnerHtml = "规格："+standard;
                }
            }
        }

        DataTable dt2 = GsBll.GetList(" GoodsID="+GoodsID).Tables[0];
        this.goodspic.DataSource = dt2;
        this.goodspic.DataBind();
    }
}